﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ReviewCurveApp.Classes;
using ReviewCurveApp.Contorller;

namespace ReviewCurveApp
{
	public partial class FrmAddSubject: Form
	{
		public FrmAddSubject()
		{
			InitializeComponent();
		}

        Subject subject = new Subject();
        SubjectsManager subjectsManager = new SubjectsManager();

        private void button_Commit_Click(object sender, EventArgs e)
        {
            subject.Name = textBox_Name.Text;

            subject.Description = textBox_Desc.Text;

            subject.Destination = textBox_Destination.Text;
            subject.Status = SubjectStatus.Initiled;


            if (!subjectsManager.AddSubject(subject))
            {
                MessageBox.Show("Adding failed !");
                return;
            }

            MessageBox.Show("Adding Successed !");

            this.DialogResult = DialogResult.OK;
        }

        private void button_Cancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
	}
}
